<script>
export default {
	globalData() {
		return {
			longitude: '',
			latitude: ''
		};
	},
	onShow: function () {
		// 获取位置信息
		let that = this.$options.globalData;
	},
	onLaunch: function () {
		// 获取城市
		// return;
		this.$getLocation()
			.then((res) => {
				this.$request({
					url: 'common/getLocation',
					data: {
						lat: uni.getStorageSync('location').latitude,
						lng: uni.getStorageSync('location').longitude
					}
				}).then((res) => {
					if (res.data.code === 1) {
						this.$store.commit('getAddress', res.data.data.address_component.city);
						let address2 = res.data.data.address_component.city;
						this.$store.commit('getAddress2', address2);
						this.$rangeObj(address2);
					}
				});
			})
			.catch((err) => {
				this.$wanlshop.msg('您拒绝了授权');
			});
	},
	onHide: function () {
		return false;
	}
};
</script>

<style lang="scss">
/*每个页面公共css */
@import './public_scss.scss';
page {
	font-family: PingFang SC-Medium;
}
view,
text,
textarea,
image {
	/* box-sizing: border-box;
		line-height: 1; */
}
</style>
